<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改服务案例')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-serinfocase-edit" th:object="${lmSerinfocase}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">案例主图：</label>
                <input name="casePic" th:field="*{casePic}" type="hidden">
                <div class="file-loading">
                    <input id="fileinput-demo-1" type="file" multiple data-min-file-count="1" data-max-file-count="1" data-theme="fas">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">案例标题：</label>
                <div class="col-sm-8">
                    <input name="caseTitle" th:field="*{caseTitle}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">案例内容：</label>
                <div class="col-sm-8">
                    <input name="caseDes" th:field="*{caseContent}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">案例图片：</label>
                <input name="serviceCase" th:field="*{caseImages}" type="hidden">
                <div class="file-loading">
                    <input id="fileinput-demo-2" type="file" multiple data-min-file-count="1" data-max-file-count="1" data-theme="fas">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var prefix = ctx + "lm/serinfocase";

        var images = $("#casePic").val().split(",");
        var cases = $("#caseImages").val().split(",");
        debugger;
        $(document).ready(function () {
            debugger;
            $("#fileinput-demo-1").fileinput({
                'uploadUrl': '#',
                overwriteInitial: true,
                initialPreviewAsData: true,
                showUpload:false,
                initialPreview: images
            });
            $("#fileinput-demo-2").fileinput({
                'uploadUrl': '#',
                overwriteInitial: true,
                initialPreviewAsData: true,
                showUpload:false,
                initialPreview: cases
            });
        });

        $("#form-serinfocase-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-serinfocase-edit').serialize());
            }
        }
    </script>
</body>
</html>